package edu.nynu.cityeasy.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 外包维保人员信息表
 * @TableName outsource_profile
 */
@TableName(value ="outsource_profile")
@Data
public class OutsourceProfile implements Serializable {
    /**
     * 关联用户ID
     */
    @TableId
    private Long userId;

    /**
     * 所属外包公司
     */
    private String company;

    /**
     * 服务类型 (如 maintenance, cleaning)
     */
    private String serviceType;

    /**
     * 外包公司工号
     */
    private String employeeId;

    /**
     * 合同结束日期
     */
    private Date contractEnd;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OutsourceProfile other = (OutsourceProfile) that;
        return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getCompany() == null ? other.getCompany() == null : this.getCompany().equals(other.getCompany()))
            && (this.getServiceType() == null ? other.getServiceType() == null : this.getServiceType().equals(other.getServiceType()))
            && (this.getEmployeeId() == null ? other.getEmployeeId() == null : this.getEmployeeId().equals(other.getEmployeeId()))
            && (this.getContractEnd() == null ? other.getContractEnd() == null : this.getContractEnd().equals(other.getContractEnd()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getCompany() == null) ? 0 : getCompany().hashCode());
        result = prime * result + ((getServiceType() == null) ? 0 : getServiceType().hashCode());
        result = prime * result + ((getEmployeeId() == null) ? 0 : getEmployeeId().hashCode());
        result = prime * result + ((getContractEnd() == null) ? 0 : getContractEnd().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", userId=").append(userId);
        sb.append(", company=").append(company);
        sb.append(", serviceType=").append(serviceType);
        sb.append(", employeeId=").append(employeeId);
        sb.append(", contractEnd=").append(contractEnd);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}